# Short Circuit Company — Lighting Technical Data CMS
# Place this file in the PROJECT ROOT (the same level as /public, /includes, /admin).
#
# Routes every request to /public internally, so URLs stay clean.
# No RewriteBase is set on purpose: Apache auto-detects it from this
# file's own location, so this works both at the domain root (production)
# and in a subfolder (local XAMPP/WAMP testing) without any edits.

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Requests already inside /public pass through untouched.
  RewriteRule ^public/ - [L]

  # Everything else is served from /public, preserving path + query string.
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Never allow the config file to be served directly by URL.
# Guarded for both modern (2.4+) and older Apache/LiteSpeed module sets,
# since a bare "Require all denied" 500s on hosts without mod_authz_core.
<IfModule mod_authz_core.c>
  <FilesMatch "^config\.php$">
    Require all denied
  </FilesMatch>
</IfModule>
<IfModule !mod_authz_core.c>
  <FilesMatch "^config\.php$">
    Order allow,deny
    Deny from all
  </FilesMatch>
</IfModule>
